﻿<UserControl x:Class="Ewav.Organizations"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    mc:Ignorable="d"
    d:DesignHeight="600" d:DesignWidth="1024" Height="614">
    <UserControl.Resources>

    </UserControl.Resources>
    <Border Background="White" BorderBrush="#FFC0CFE2" BorderThickness="4">
        <Border.Effect>
            <DropShadowEffect Color="#FFBCB9B9" ShadowDepth="3" BlurRadius="43" Direction="166"/>
        </Border.Effect>
        <Grid x:Name="LayoutRoot">
            <Grid x:Name="HeaderGrid" VerticalAlignment="Top" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.917*"/>
                    <ColumnDefinition Width="25"/>
                </Grid.ColumnDefinitions>
                <TextBlock TextWrapping="Wrap" Text="Organizations" FontSize="21.333" FontWeight="Bold" FontFamily="Segoe UI" Width="235" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment" VerticalAlignment="Top" Margin="10,1,0,0"/>
                <Rectangle x:Name="GHeader" VerticalAlignment="Top" Height="4" Margin="10,33,0,0" StrokeThickness="0" Fill="#FF00B050" HorizontalAlignment="Left" Width="204" />
            </Grid>

            <StackPanel Margin="10,39,10,10" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Top">
                <StackPanel x:Name="spOrganizationList" Visibility="Visible">
                    <!--<StackPanel x:Name="spMsg1" VerticalAlignment="Top" Orientation="Horizontal" Background="#FFF1CAC2" Margin="0,9,0,0">
                    <Image HorizontalAlignment="Left" Height="20" Source="../../images/ErrorD.png" Stretch="Fill" Width="20" VerticalAlignment="Center" Margin="10,6,0,6"/>
                    <TextBlock TextWrapping="Wrap" Text="The email or password you entered is incorrect." FontFamily="Segoe UI" Foreground="#FF601919" Margin="6,6,0,6" FontSize="13.333" FontWeight="Normal" VerticalAlignment="Center"/>
                </StackPanel>-->
                    <StackPanel x:Name="spMsg" VerticalAlignment="Top" Orientation="Horizontal" Margin="10,16,0,0" Background="#FFDCECBB" UseLayoutRounding="True" Visibility="Collapsed">
                        <Image x:Name="imgerrMsg" HorizontalAlignment="Left" Height="20" Source="../../images/ErrorD.png" Stretch="Fill" Width="20" VerticalAlignment="Center" Margin="10,6,0,6" Visibility="Collapsed"/>
                        <Image x:Name="imgSMsg" HorizontalAlignment="Left" Height="20" Source="../../images/successD.png" Stretch="Fill" Width="20" VerticalAlignment="Center" Margin="10,6,0,6"/>
                        <TextBlock x:Name="SucessMsg" TextWrapping="Wrap" Text="" FontFamily="Segoe UI" Foreground="#FF445818" Margin="6,6,0,6" FontSize="13.333" FontWeight="Bold" VerticalAlignment="Center"/>
                    </StackPanel>
                    <!--<StackPanel x:Name="spMsg1" VerticalAlignment="Top" Orientation="Horizontal" Background="#FFF1CAC2" Margin="0,9,0,0">
                    <Image HorizontalAlignment="Left" Height="20" Source="../../images/ErrorD.png" Stretch="Fill" Width="20" VerticalAlignment="Center" Margin="10,6,0,6"/>
                    <TextBlock TextWrapping="Wrap" Text="The email or password you entered is incorrect." FontFamily="Segoe UI" Foreground="#FF601919" Margin="6,6,0,6" FontSize="13.333" FontWeight="Normal" VerticalAlignment="Center"/>
                </StackPanel>-->
                    <Button x:Name="btnAddOrg"  Content="Add New Organization" 
						FontFamily="Segoe UI" VerticalAlignment="Top" 
						HorizontalAlignment="Left" Width="192" Click="btnAddOrg_Click"  Margin="10,16,0,5" Style="{StaticResource btnprimary}" Padding="5,6" Height="30"/>
                    <sdk:DataPager PageSize="10" VerticalAlignment="Top" Margin="475,-33,0,0" HorizontalAlignment="Left" Background="{x:Null}" BorderBrush="{x:Null}" Visibility="Collapsed"/>
                    <sdk:DataGrid x:Name="dgOrg" RowHeight="35" 
						AutoGenerateColumns="False"     DataContext="{Binding}" 
						HorizontalAlignment="Left" MinHeight="250" MaxHeight="400" VerticalAlignment="Top" 
						AreRowGroupHeadersFrozen="False" Margin="10,3,0,0" IsReadOnly="True">
                        <sdk:DataGrid.Columns>
                            <!--
    					<sdk:DataGridTextColumn Binding="{Binding FirstName}" Header="Organization Name" Width="250" />
    					<sdk:DataGridTextColumn Binding="{Binding LastName}" Header="Active" Width="80"/>
    					<sdk:DataGridTextColumn Binding="{Binding FirstName}" Header="Users" Width="80"/>
    					<sdk:DataGridTextColumn Binding="{Binding LastName}" Header="Datasources" Width="100"/>
                     -->
                            <sdk:DataGridTextColumn Binding="{Binding Name, Mode=TwoWay}" Header="Organization Name" Width="250" />
                            <sdk:DataGridTextColumn Binding="{Binding Active, Mode=TwoWay}" Header="Active" Width="80"/>
                            <sdk:DataGridTextColumn Binding="{Binding TotalUserCount, Mode=TwoWay}" Header="Users" Width="80"/>
                            <sdk:DataGridTextColumn Binding="{Binding DatasourceCount, Mode=TwoWay}" Header="Datasources" Width="100"/>
                            <sdk:DataGridTemplateColumn Width="80" >
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="8,0,0,0">
                                            <!--<TextBlock Text="" Width="15"/>
                                        <Button Content="Delete" FontFamily="Segoe UI" FontSize="13.333" VerticalAlignment="Top" HorizontalAlignment="Left" d:LayoutOverrides="VerticalAlignment" Width="60" Padding="5,4,5,4" Style="{StaticResource btnstyle1}"/>-->
                                            <Button Content="Edit" x:Name="btnEditOrg"   Click="btnEditOrg_Click" Style="{StaticResource btnprimary}"  VerticalAlignment="Top" HorizontalAlignment="Left" d:LayoutOverrides="VerticalAlignment" Width="60"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </StackPanel>
                <StackPanel x:Name="spOrganizationEdit" HorizontalAlignment="Left"   Margin="10,8,0,0" VerticalAlignment="Top" Visibility="Collapsed">
                    <TextBlock TextWrapping="Wrap" Text="Add/Edit Organization" FontSize="21.333" FontWeight="Bold" FontFamily="Segoe UI" Height="30" Width="235" HorizontalAlignment="Left"/>

                    <!--<StackPanel x:Name="spMsg" VerticalAlignment="Top" Orientation="Horizontal" Background="#FFF1CAC2" Margin="0,9,0,18">
                    <Image HorizontalAlignment="Left" Height="20" Source="../../images/ErrorD.png" Stretch="Fill" Width="20" VerticalAlignment="Center" Margin="10,6,0,6"/>
                    <TextBlock TextWrapping="Wrap" x:Name="tbMessage" Text="The email or password you entered is incorrect." FontFamily="Segoe UI" Foreground="#FF601919" Margin="6,6,0,6" FontSize="13.333" FontWeight="Normal" VerticalAlignment="Center"/>
                </StackPanel>-->
                    <TextBlock TextWrapping="Wrap" Text="Organization Name:" Width="153" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold" HorizontalAlignment="Left" Margin="0,8,0,0"/>
                    <TextBox TextWrapping="Wrap" x:Name="tbOrganizationName" Height="30" Width="434"      Text="{Binding Name, Mode=TwoWay}"   Margin="183,-22,0,0" HorizontalAlignment="Left"/>
                    <TextBlock TextWrapping="Wrap" Text="Active:" Width="153" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold" HorizontalAlignment="Left" Margin="0,13,0,0"/>
                    <ComboBox Width="155" x:Name="cboActive" Height="30" HorizontalAlignment="Left" Margin="184,-20,0,0">
                        <ComboBoxItem Content="Yes"/>
                        <ComboBoxItem Content="No"/>
                    </ComboBox>
                    <StackPanel x:Name="spUser" HorizontalAlignment="Left" Margin="0,24,0,10" VerticalAlignment="Top">
                        <TextBlock x:Name="txtOrgAdmin" TextWrapping="Wrap" Text="Organization Administrator:" Width="254" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold" HorizontalAlignment="Left" Margin="0"/>
                        <TextBlock HorizontalAlignment="Left" Margin="8,17,0,0" TextWrapping="Wrap" Text="Email:" Width="153" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold"/>
                        <!--<TextBox x:Name="tbEmail"  Margin="178,-25,20,0"            Text="{Binding Email, Mode=TwoWay}"    TextWrapping="Wrap" Height="30" Width="262" HorizontalAlignment="Left" VerticalAlignment="Top"/>-->
                        <Grid x:Name="grdWindows" Visibility="Collapsed">
                            <TextBox x:Name="tbEmailAddress" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="178,-25,20,0" Height="30" Width="262" Text="{Binding EmailAddress, Mode=TwoWay}"  />
                            <Button x:Name="btnSearch" Width="55" Click="btnSearch_Click" Margin="453,-29,49,1" Content="Find" HorizontalAlignment="Left" VerticalAlignment="Top" />
                            <TextBox x:Name="tbUserId" Visibility="Collapsed" Text="{Binding UserName, Mode=TwoWay}" />
                        </Grid>
                        <Grid x:Name="grdForms">
                            <sdk:AutoCompleteBox x:Name="autoEmail" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="178,-25,20,0" Height="30" Width="262" Text="{Binding UserName, Mode=TwoWay}" DropDownClosed="autoEmail_DropDownClosed" />
                            <!--<Button x:Name="btnSearch" Width="55" Click="btnSearch_Click" Margin="453,-29,49,1" Content="Find" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Collapsed" />-->
                        </Grid>
                        <TextBlock HorizontalAlignment="Left" Margin="8,17,0,0" TextWrapping="Wrap" Text="First Name:" Width="153" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold"/>
                        <TextBox   x:Name="tbFirstName"          Text="{Binding FirstName, Mode=TwoWay}"      Margin="178,-22,20,0" TextWrapping="Wrap" Height="30" Width="262" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                        <TextBlock HorizontalAlignment="Left" Margin="8,17,0,0" TextWrapping="Wrap" Text="Last Name:" Width="153" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold"/>
                        <TextBox x:Name="tbLastName"  Margin="178,-24,20,0"       Text="{Binding LastName, Mode=TwoWay}"   TextWrapping="Wrap" Height="30" Width="262" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                        <TextBlock HorizontalAlignment="Left" Margin="8,17,0,0" TextWrapping="Wrap" Text="Phone:" Width="153" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold"/>
                        <TextBox  x:Name="tbPhone" Margin="178,-23,20,0" TextWrapping="Wrap"      Text="{Binding Phone, Mode=TwoWay}"    Height="30" Width="262" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                        <!--  <TextBlock HorizontalAlignment="Left" Margin="8,17,0,0" TextWrapping="Wrap" Text="Role:" Width="152" FontFamily="Segoe UI" FontSize="13.333" FontWeight="Bold"/>
                   <ComboBox x:Name="cmbRole"  Height="30" Width="262" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="178,-23,20,0" ItemsSource="{Binding}" SelectionChanged="cmbRole_SelectionChanged" >
                        <ComboBoxItem Name="admin" Content="Administrator"/>
                        <ComboBoxItem Name="user" Content="User"/>
                    </ComboBox>
                    <StackPanel x:Name="spAssignDatasources" >
                        <TextBlock HorizontalAlignment="Left" Margin="8,17,0,0" TextWrapping="Wrap" Text="Associate Data Sources:" Width="212" FontFamily="Segoe UI" FontSize="16" FontWeight="Bold"/>
                        <ListBox x:Name="lbxAvailable" HorizontalAlignment="Left" SelectedIndex="0" Width="160" SelectionMode="Extended" BorderThickness="1" Height="132" VerticalAlignment="Top" Margin="8,6,0,0"/>
                        <Button x:Name="btnAddSource" Content="&gt;&gt;" HorizontalAlignment="Left" Width="49" VerticalAlignment="Top" Margin="194,-112,0,0" Click="btnAddSource_Click" />
                        <Button x:Name="btnRemoveSource" Content="&lt;&lt;" Width="49" HorizontalAlignment="Left"  VerticalAlignment="Top" Margin="194,-55,0,0" Click="btnRemoveSource_Click" />
                        <ListBox x:Name="lbxSelected" HorizontalAlignment="Left" SelectedIndex="0" Width="160" SelectionMode="Single" BorderThickness="1"  Height="132" VerticalAlignment="Top" Margin="277,-132,0,0"  />
                    </StackPanel>-->
                        <!--<Button x:Name="btnSaveUserDetails" Content="Save" Click="btnSaveUserDetails_Click"  Margin="6,31,0,0" FontFamily="Segoe UI" FontSize="13.333" Background="#FF63A6DF" Foreground="White" VerticalAlignment="Top" HorizontalAlignment="Left" Width="136" Style="{StaticResource btnstyle1}" Height="30" Padding="5,6"/>
                    <Button x:Name="btnCancelUserDetails" Content="Cancel" Click="btnCancelUserDetails_Click" Margin="357,-30,20,0" FontFamily="Segoe UI" FontSize="13.333" Background="#FFD2D2D2" Foreground="#FF252525" VerticalAlignment="Top" HorizontalAlignment="Left" Width="81" Height="29" Style="{StaticResource btnstyle2}"/>-->
                    </StackPanel>
                    <!--<Button Content="Add New Admin" x:Name="btnAddAdmin"     Click="btnAddAdmin_Click"  FontFamily="Segoe UI" FontSize="13.333" Background="#FF63A6DF" Foreground="White" Width="136" Margin="0,20,0,0" HorizontalAlignment="Left" Style="{StaticResource btnstyle1}" Height="30"/>
                <sdk:DataPager PageSize="10" VerticalAlignment="Top" Margin="604,-36,0,0" Background="{x:Null}" HorizontalAlignment="Left"/>
                <sdk:DataGrid x:Name="dgUsers" RowHeight="35" AutoGenerateColumns="False"            DataContext="{Binding}" HorizontalAlignment="Left" MinHeight="100" MaxHeight="250" VerticalAlignment="Top" AreRowGroupHeadersFrozen="False" Margin="0,1,0,0">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Binding="{Binding FirstName}" Header="First Name" Width="160"/>
                        <sdk:DataGridTextColumn Binding="{Binding LastName}" Header="Last Name" Width="160"/>
                        <sdk:DataGridTextColumn Binding="{Binding Email}" Header="Email" Width="160"/>
                        <sdk:DataGridTextColumn Binding="{Binding Phone}" Header="Phone" Width="160"/>
                        <sdk:DataGridTemplateColumn Width="160" >
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                        <Button Content="Edit" x:Name="btnEditUsers" Click="btnEditUsers_Click"   FontFamily="Segoe UI" FontSize="13.333" Background="#FF63A6DF" Foreground="White" VerticalAlignment="Top" HorizontalAlignment="Left" d:LayoutOverrides="VerticalAlignment" Width="60" Style="{StaticResource btnstyle1}"/>
                                        <TextBlock Text="" Width="15"/>
                                        <Button Content="Delete" FontFamily="Segoe UI" FontSize="13.333" Background="#FF63A6DF" Foreground="White" VerticalAlignment="Top" HorizontalAlignment="Left" d:LayoutOverrides="VerticalAlignment" Width="60" Style="{StaticResource btnstyle1}" />
                                    </StackPanel>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
                <TextBlock Height="19" x:Name="tbNoOrgAdminsAdded" TextWrapping="Wrap" Text="No Org Admins have been added." Width="194" HorizontalAlignment="Left" Margin="8,-127,0,0"/>-->
                    <Button x:Name="btnSaveOrgDetails" Content="Save" FontFamily="Segoe UI"     IsEnabled="True"                  FontSize="13.333" Background="#FF63A6DF" Foreground="White" Width="136" Click="btnSaveOrgDetails_Click"  HorizontalAlignment="Left" Margin="178,16,0,0" Style="{StaticResource btnstyle1}" Height="30"/>
                    <Button x:Name="btnCancelOrgDetails" Content="Cancel" FontFamily="Segoe UI" FontSize="13.333" HorizontalAlignment="Left" Width="76" Click="btnCancelOrgDetails_Click"  Margin="362,-30,0,0" Style="{StaticResource btnstyle2}"/>
                </StackPanel>
            </StackPanel>
            <Grid x:Name="waitCursor" Background="#36C4C4C4" Height="Auto" Visibility="Collapsed">
                <toolkit:BusyIndicator x:Name="BusyIndicator" IsBusy="True" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="100" Style="{StaticResource busy}" />
            </Grid>
        </Grid>
    </Border>
</UserControl>
